<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8" />
	<title>书店管理系统</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<link rel="stylesheet" type="text/css" href="/public/css/bootstrap.min.css" />
	<link rel="stylesheet" type="text/css" href="/public/css/swiper.min.css" />
	<link href="http://cdn.bootcss.com/animate.css/3.5.2/animate.min.css" rel="stylesheet" media="all">
	<link href="/public/css/bootstrap-touch-slider.css" rel="stylesheet" media="all">
	<link rel="stylesheet" type="text/css" href="/public/css/pc.css" />
	<link rel="stylesheet" type="text/css" media="screen and (max-width:1200px)" href="/public/css/ipad.css">
	<link rel="stylesheet" type="text/css" media="screen and (max-width:768px)" href="/public/css/phone.css">
	<script type="text/javascript" src="/public/js/jquery-1.11.1.min.js"></script>
	<script type="text/javascript" src="/public/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="/public/js/swiper.min.js"></script>
	<script type="text/javascript" src="/public/js/scrollReveal.js"></script>
	<script src="http://cdn.bootcss.com/jquery.touchswipe/1.6.18/jquery.touchSwipe.min.js"></script>
	<script src="/public/js/bootstrap-touch-slider-min.js"></script>
	<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=Diy1GpUowSnG4kyw93KWvG4GfQDm3xch"></script>

	<!-- 地区插件 -->
	<script src="/public/js/distpicker.data.js"></script>	
	<script src="/public/js/distpicker.js"></script>
	<script src="/public/js/main.js"></script>	

	<script type="text/javascript" src="/public/js/jquery.cookie.js"></script>
	<script type="text/javascript" src="/public/js/base64.js"></script>
	<script type="text/javascript" src="/public/js/xiuzhen.js"></script>
	<script>
		if ($(document.body).width() < 760) {
			document.documentElement.style.fontSize = document.documentElement.clientWidth / 7.5 + 'px';
		} else {
			document.documentElement.style.fontSize = document.documentElement.clientWidth / 1 + 'px';
		}
	</script>
	<!--兼容ie8-->
	<!--[if lt IE 9]>
	    <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
	    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
	<!-- 头部导航开始 -->
	<div class="header">
		<div class="nav">
			<img class="logo" src="/public/images/logo.png" alt="">
			<ul class="top">
				<li>
					<a href="index.html">首页</a>
				</li>
				<li>
					<a href="box.html">图书展示</a>
				</li>
				<li>
					<a href="labOne.html">图书资讯</a>

				</li>
				
				<li>
					<a href="about.html">关于我们</a>
				</li>
				<li>
					<a href="contact.html">联系我们</a>
				</li>
			</ul>
			<div class="right">
				<a href="login.html" class="login">会员登陆</a>
				
				<a class="indexCart" href="cart.html">
					<img class="cart" src="/public/images/cart.png" alt="">
				</a>
				<a class="leaguer" href="member.html" style="display: none;">
					<img class="" src="/public/images/people2.png" alt="">
				</a>
				<p id="username" style="display: none;"></p>
				<!-- <p class="line"></p>
				<img class="weixin" src="images/weixin.png" alt=""> -->
			</div>
		</div>
	</div>

	<!-- 注册页面样式 -->
	<div class="register">
		<img class="logo" src="/public/images/logo.png" alt="">
		<p class="title">找回密码</p>
		<form action="" id="findPassword">
			<div class="form">
				<div class="account phone">
					<input type="text" name="phoneNumber" class="form-control item phoneNumber" placeholder="请输入手机号">
				</div>
				<div class="identify">
					<input type="text" class="form-control item imgCode" placeholder="请输入验证码">
					<div id="v_container" style="width: 200px;height: 50px;"></div>
				</div>
				<!--<div class="phoneCode">
					<input type="text" name="code" class="form-control item phoneCode1" placeholder="请输入手机验证码">
					<a href="javascript:;" class="code">获取验证码</a>
				</div>-->
				<div class="password1">
					<input type="password" name="password" class="form-control item password2" placeholder="输入密码">
				</div>
				<div class="password">
					<input type="password" class="form-control item password3" placeholder="请确认密码">
				</div>
				<a href="javascript:;" class="submit">找回密码</a>
			</div>
		</form>
		
	</div>


	<!-- 预约弹框样式 -->
	<div class="appointShadow"></div>

	<!-- 右侧弹框 -->
	<div class="rightFrame">
		<div class="bespoke"><a href="saleApply.html">代售申请</a></div>
		<div class="placement"><img src="/public/images/top.png" alt="">置顶</div>
	</div>

	<!-- 弹框样式 -->
	<div class="alert-box">
		<span class="xz-alert alert alert-danger"></span>
	</div>

	<!-- 公共底部开始 -->
	<div class="footer">
		<div class="footer-content1">
			<div></div>
		</div>
		<div class="footer-content">
			<div class="container">
				<div class="content">
					<div class="left">
						<img class="bottom-logo" src="/public/images/logo.png" alt="">
						<p class="des">此系统为不仅为人们提供了便利的购书平台，还在此基础上增加了代售和出租的功能，人们有想卖的书籍可以在此平台申请，平台会帮忙代售，还有的宝宝们，不想购买书籍，此平台提供了租书的功能，不需要购买就可以便宜看到自己想看的书籍啦！！！</p>
					</div>
					<div class="right">
						<div class="contact">
							<p class="title">联系我们</p>
							<p class="phone">电话：0755-23324516</p>
							<p class="email">邮箱：cd.01@oil-com.com</p>
							<p class="email">QQ：1056598469</p>
						</div>
					</div>
				</div>
				<p class="copy">地址：山西省太原市万柏林区下元街道公园时代城2号楼1301</p><br>
			</div>
		</div>	
		
	</div>

	<script type="text/javascript">
	

		var loginUrl = Base64.encode("findPassword.html");  
		$('.header .nav .right .login').attr('href','./login.html?loginurl='+loginUrl); 

		// 首页banner
		$('#bootstrap-touch-slider').bsTouchSlider();

		// 点击返回顶部
		$('.rightFrame .placement').on('click', function () {
			$("html,body").animate({
				scrollTop: 0
			}, 1000);
		});

		// 点击预约课程以及点击关闭弹框
		$('.rightFrame .bespoke').on('click', function () {
			$(".appointShadow").css("display","block");
			$(".appoint").css("display","block");
		});	
		$('.appoint .close').on('click', function () {
			$(".appointShadow").css("display","none");
			$(".appoint").css("display","none");
		});


		
		$(function(){
			var nums = 120;
			var clock = '';
			var verifyCode = new GVerify("v_container");
			// 验证手机号
			function isPhoneNo(phone) {
				var pattern = /^1[34578]\d{9}$/;
				return pattern.test(phone);
			}
			$("#findPassword .submit").click(function(){
				if($("#findPassword .phoneNumber").val() == ""){
					$(".xz-alert").html("手机号不能为空!");
					$('.xz-alert').show();
					setTimeout(function () {
						$(".xz-alert").hide();
					}, 1000);
				}else if(isPhoneNo($.trim($("#findPassword .phoneNumber").val())) == false){
					$(".xz-alert").html("手机号码不正确!");
					$('.xz-alert').show();
					setTimeout(function () {
						$(".xz-alert").hide();
					}, 1000);
				}else if($("#findPassword .imgCode").val() == ""){
					$(".xz-alert").html("图形验证码不能为空!");
					$('.xz-alert').show();
					setTimeout(function () {
						$(".xz-alert").hide();
					}, 1000);
				}else if( !verifyCode.validate ($("#findPassword .imgCode").val()) ){
					$(".xz-alert").html("图形验证码不正确!");
					$('.xz-alert').show();
					setTimeout(function () {
						$(".xz-alert").hide();
					}, 1000);
				}else if($("#findPassword .password2").val() == ""){
					$(".xz-alert").html("密码不能为空!");
					$('.xz-alert').show();
					setTimeout(function () {
						$(".xz-alert").hide();
					}, 1000);
				}else if($("#findPassword .password2").val().length < 6){
					$(".xz-alert").html("密码不能少于6位!");
					$('.xz-alert').show();
					setTimeout(function () {
						$(".xz-alert").hide();
					}, 1000);
				}else if($("#findPassword .password2").val() != $("#findPassword .password3").val()){
					$(".xz-alert").html("两次输入的密码不一致!");
					$('.xz-alert').show();
					setTimeout(function () {
						$(".xz-alert").hide();
					}, 1000);
				}else{
					$.ajax({
						type: "post",
						dataType: "json", // submit info
						url: url + '/v1/front/user/find',
						data:$("#findPassword").serializeArray(),
						contentType:"application/x-www-form-urlencoded",
						success: function (res) {
							if (!res.resultStatus) {
								$(".xz-alert").html(res.errorMessage);
								$('.xz-alert').show();
								setTimeout(function () {
									$(".xz-alert").hide();
								}, 1000);
								return
							}
							$(".xz-alert").html("找回密码成功！");
							$('.xz-alert').show();
							setTimeout(function () {
								$(".xz-alert").hide();
								location.href = './login.html';
							}, 1000);	
						},
						error: function (e) {
							$(".xz-alert").html("注册失败");
							$('.xz-alert').show();
							setTimeout(function () {
								$(".xz-alert").hide();
							}, 1000);
						}
				
					})
				}
				
			})

			// 点击获取手机验证码
			$("#findPassword .form .phoneCode .code").click(function(){
				if($("#findPassword .imgCode").val() == ""){
					$(".xz-alert").html("图形验证码不能为空!");
					$('.xz-alert').show();
					setTimeout(function () {
						$(".xz-alert").hide();
					}, 1000);
				}else if( !verifyCode.validate ($("#findPassword .imgCode").val()) ){
					$(".xz-alert").html("图形验证码不正确!");
					$('.xz-alert').show();
					setTimeout(function () {
						$(".xz-alert").hide();
					}, 1000);
				}else if($("#findPassword .phoneNumber").val() == ""){
					$(".xz-alert").html("手机号不能为空!");
					$('.xz-alert').show();
					setTimeout(function () {
						$(".xz-alert").hide();
					}, 1000);
				}else if(isPhoneNo($.trim($("#findPassword .phoneNumber").val())) == false){
					$(".xz-alert").html("手机号码不正确!");
					$('.xz-alert').show();
					setTimeout(function () {
						$(".xz-alert").hide();
					}, 1000);
				}else{
					$.ajax({
						type: "post",
						dataType: "", // submit info
						url: url + '/common/code',
						data:{phone:$("#findPassword .phoneNumber").val()},
						contentType:"application/x-www-form-urlencoded",
						success: function (res) {
							if (!res.resultStatus) {
								$(".xz-alert").html(res.errorMessage);
								$('.xz-alert').show();
								setTimeout(function () {
									$(".xz-alert").hide();
								}, 1000);
								return
							}
							$(".xz-alert").html("发送成功！");
							$('.xz-alert').show();
							setTimeout(function () {
								$(".xz-alert").hide();
							}, 1000);

							$("#findPassword .form .phoneCode .code").html("等待"+ nums +"秒");
							clock = setInterval(countDown, 1000); //一秒执行一次


							
						},
						error: function (e) {
							$(".xz-alert").html("请求数据失败");
							$('.xz-alert').show();
							setTimeout(function () {
								$(".xz-alert").hide();
							}, 1000);
						}
				
					})
				}
				
			})

			// 倒计时函数
			function countDown(){
				nums--;
				if(nums > 0){
					$("#findPassword .form .phoneCode .code").html("等待"+ nums +"秒");
				}else{
					clearInterval(clock); //清除js定时器
					$("#findPassword .form .phoneCode .code").html("获取验证码");
					nums = 120; //重置时间
				}
			}

		})
		
		


		// 获取手机验证码
		!(function(window, document) {
			var size = 4;//设置验证码长度
			function GVerify(options) { //创建一个图形验证码对象，接收options对象为参数
				this.options = { //默认options参数值
					id: "", //容器Id
					canvasId: "verifyCanvas", //canvas的ID
					width: "100", //默认canvas宽度
					height: "30", //默认canvas高度
					type: "blend", //图形验证码默认类型blend:数字字母混合类型、number:纯数字、letter:纯字母
					code: "",
				}
				if(Object.prototype.toString.call(options) == "[object Object]"){//判断传入参数类型
					for(var i in options) { //根据传入的参数，修改默认参数值
						this.options[i] = options[i];
					}
				}else{
					this.options.id = options;
				}
				
				this.options.numArr = "0,1,2,3,4,5,6,7,8,9".split(",");
				this.options.letterArr = getAllLetter();

				this._init();
				this.refresh();
			}

			GVerify.prototype = {
				/**版本号**/
				version: '1.0.0',
				
				/**初始化方法**/
				_init: function() {
					var con = document.getElementById(this.options.id);
					var canvas = document.createElement("canvas");
					this.options.width = con.offsetWidth > 0 ? con.offsetWidth : "100";
					this.options.height = con.offsetHeight > 0 ? con.offsetHeight : "30";
					canvas.id = this.options.canvasId;
					canvas.width = this.options.width;
					canvas.height = this.options.height;
					canvas.style.cursor = "pointer";
					canvas.innerHTML = "您的浏览器版本不支持canvas";
					con.appendChild(canvas);
					var parent = this;
					canvas.onclick = function(){
						parent.refresh();
					}
				},
				
				/**生成验证码**/
				refresh: function() {
					this.options.code = "";
					var canvas = document.getElementById(this.options.canvasId);
					if(canvas.getContext) {
						var ctx = canvas.getContext('2d');
					}else{
						return;
					}
					
					ctx.textBaseline = "middle";

					ctx.fillStyle = randomColor(180, 240);
					ctx.fillRect(0, 0, this.options.width, this.options.height);

					if(this.options.type == "blend") { //判断验证码类型
						var txtArr = this.options.numArr.concat(this.options.letterArr);
					} else if(this.options.type == "number") {
						var txtArr = this.options.numArr;
					} else {
						var txtArr = this.options.letterArr;
					}

					for(var i = 1; i <=size; i++) {
						var txt = txtArr[randomNum(0, txtArr.length)];
						this.options.code += txt;
						ctx.font = randomNum(this.options.height/2, this.options.height) + 'px SimHei'; //随机生成字体大小
						ctx.fillStyle = randomColor(50, 160); //随机生成字体颜色        
						ctx.shadowOffsetX = randomNum(-3, 3);
						ctx.shadowOffsetY = randomNum(-3, 3);
						ctx.shadowBlur = randomNum(-3, 3);
						ctx.shadowColor = "rgba(0, 0, 0, 0.3)";
						var x = this.options.width / (size+1) * i;
						var y = this.options.height / 2;
						var deg = randomNum(-30, 30);
						/**设置旋转角度和坐标原点**/
						ctx.translate(x, y);
						ctx.rotate(deg * Math.PI / 180);
						ctx.fillText(txt, 0, 0);
						/**恢复旋转角度和坐标原点**/
						ctx.rotate(-deg * Math.PI / 180);
						ctx.translate(-x, -y);
					}
					/**绘制干扰线**/
					for(var i = 0; i < 4; i++) {
						ctx.strokeStyle = randomColor(40, 180);
						ctx.beginPath();
						ctx.moveTo(randomNum(0, this.options.width), randomNum(0, this.options.height));
						ctx.lineTo(randomNum(0, this.options.width), randomNum(0, this.options.height));
						ctx.stroke();
					}
					/**绘制干扰点**/
					for(var i = 0; i < this.options.width/4; i++) {
						ctx.fillStyle = randomColor(0, 255);
						ctx.beginPath();
						ctx.arc(randomNum(0, this.options.width), randomNum(0, this.options.height), 1, 0, 2 * Math.PI);
						ctx.fill();
					}
				},
				
				/**验证验证码**/
				validate: function(code){
					var code = code.toLowerCase();
					var v_code = this.options.code.toLowerCase();
					if(code == v_code){
						return true;
					}else{
						this.refresh();
						return false;
					}
				}
			}
			/**生成字母数组**/
			function getAllLetter() {
				var letterStr = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";
				return letterStr.split(",");
			}
			/**生成一个随机数**/
			function randomNum(min, max) {
				return Math.floor(Math.random() * (max - min) + min);
			}
			/**生成一个随机色**/
			function randomColor(min, max) {
				var r = randomNum(min, max);
				var g = randomNum(min, max);
				var b = randomNum(min, max);
				return "rgb(" + r + "," + g + "," + b + ")";
			}
			window.GVerify = GVerify;
		})(window, document);
	</script>		

</body>

</html>